Step 1: Create the report in Vitalware

As with any other report, the first step is to build the report in Vitalware.

Note: For full details of how to create the report in Vitalware, see Step 1: Create the report in Vitalware.

Note: Ensure that Microsoft Word is closed before creating a new report.

In Vitalware:

  1. On the Report Type tab of the Report Properties box, select Microsoft Word from the Type drop list.
  2. On the Fields tab, add the following fields:

    Module

    Field Name

    Column Name

    InvoiceDate: (Payment Details)InvPaymentDate0
    Type: (Payment Details)InvPaymentType_tab
    Invoiced/Total: (Invoice Details)InvTotalOrdered
    PartiesName: (Customer Details) 
    First: (Person Details)NamFirst
    Last: (Person Details)NamLast
    Salutation: (Derived Names)NamSalutation
    OrganisationNamOrganisation
    Street: (Postal Address)AddPostStreet
    Street (Physical Address)AddPhysStreet
    City/Town: (Postal Address)AddPostCity
    City/Town: (Physical Address)AddPhysCity
    State/Province: (Postal Address)AddPostState
    State/Province: (Physical Address)AddPhysState
    Postal/Zip Code: (Postal Address)AddPostPost
    Postal/Zip Code: (Physical Address)AddPhysPost
    Position: (Organization Details)NamPostion
    Department: (Organisation Details)NamDepartment
    OrdersProduct: (Product Details)OrdProduct
    Quantity: (Product Details)OrdQuantity

    The Fields tab will appear similar to:

    For details about adding fields see 2. Select the fields to include in the report: the Fields tab, where you will find an explanation for how to convert table fields (indicated by a Nested table icon icon beside the field name) to text using the Table as Text Table as text option. Converting a table field to text greatly simplifies the coding required to include its data in a report: when a table field is converted to text its data is included in the main .csv file generated when the report is run in Vitalware, rather than being exported as a separate .csv file.

    Note: Fields that are both an attachment field AND a table of values - Object: (Objects Loaned) in the example above - CANNOT be included in the main .csv file using the Table as Text Table as text option. In this case it is necessary to add additional Visual Basic Code to the mail merge report in order to include data from the additional .csv file(s) in the report. We look at how to do this later.

  3. Run the report in Vitalware.

When we run this report two .csv files will be generated:

  • einvoice.csv (which is the main .csv file and contains data from the Invoice and Parties modules)
  • Invorder.csv (which contains price and product data)

We will look at creating a report where:

  • Only one .csv file is generated

    In this example, we use the main .csv file (einvoice.csv). In the majority of cases in which only a single .csv file is generated when a report is run out of Vitalware, the steps described here are all you will require to create a mail merge report. At this stage the report will include details about the transaction and the purchaser (but not the items purchased).

    Note: The steps described here for connecting to the DSN are required whether you have one or more than one .csv file to access.

  • More than one .csv file is generated

    We will then adapt our report to access data included in the second .csv file (Invorder.csv) in order to include details about the items purchased.